<!DOCTYPE html>
<html lang="en">
<head>
    <meta charset="UTF-8">
    <meta name="viewport" content="width=device-width, initial-scale=1.0">
    <title>正则表达式</title>
</head>
<body>
    <script>
        // let regexp1 = /abc/;
        // let regexp2 = new RegExp("abc");

        // let str = "abcdefghijklabc";
        // console.log(regexp1.test(str));
        // console.log(str.match(regexp2));

        // let message = "hello abc ABC aBC abC";
        // let regexp1 = /abc/ig
        // let strs =  message.match(regexp1);
        // console.log(strs);

        // //匹配数字，单一的数字
        // let message = "123 abcj 234 0909 _";
        // let regexp = /\d/g;
        // console.log(message.match(regexp));
        
        // //匹配拉丁字符
        // let regexp2 = /\w/g;
        // console.log(message.match(regexp2));
       
        // //匹配所有字符除了换行符
        // let regexp3 = /./g;
        // console.log(message.match(regexp3));

        // //匹配空格
        // let regexp4 = /\s/g;
        // console.log(message.match(regexp4));
   
        // let message1 = "abc jjj llll";
        // let message2 = "    ABc";
        // let regexp1 = /^abc/;
        // let regexp2 = /abc$/i;
        
        // console.log(message1.match(regexp1));
        // console.log(message2.match(regexp2));

        // //词边界：\b
        // let infos = "now time is 11:56,12:00 eat food,number is 123:456"
        // let timeRegexp =/\b\d\d\:\d\d\b/ig;
        // console.log(infos.match(timeRegexp));

        // //匹配手机号
        // let phoneNumbber = ["12345678910","123","13787401591","19987401591","11087401591"];
        // let regexp1 = /^(1[3-9][0-9])/;
        // for(num of phoneNumbber)
        // {
          
        //    if(num.length == 11)
        //    {
        //       if(regexp1.test(num))
        //       {
        //           console.log(num);
        //       }
        //    }
        // }
   
        // //匹配标签
        // const message = "<div></div>hahha<span></span>我是傻逼<a>"
        // let regexp = /<\/?[a-z]*>/ig;
        // console.log(message.match(regexp));

        //懒惰模式
        let message = "我喜欢的书有：《白鹿原》《平凡的世界》《人生》";
        let regexp = /《.+?》/ig//在+后面加上?开启懒惰模式
        console.log(message.match(regexp));

    </script>
</body>
</html>